import http from '@/utils/http'

export class FilesService {
  static async uploadFiles(files: any) {
    return http.post({
      url: "files/uploadfiles",
      data: { files: files },
      headers: {
        "Content-Type": "multipart/form-data",
      },
    });
  }

  static deleteFile(fileName: string) {
    return http.delete({
      url: "files/delete_file",
      data: { filename: fileName },
    });
  }

  static getTaskLog(taskId: string) {
    return http.post({
      url: "files/read_test_log",
      data: { taskid: taskId },
    });
  }

  static downloadReport(taskId: string, url: string) {
    return http.post({
      url: "files/download_excel",
      data: {
        taskid: taskId,
        url: url,
      },
      responseType: "blob",
    });
  }
}